import UI.Changeinfo;
import UI.Charger;

import java.awt.*;
import java.awt.event.*;
import java.sql.SQLException;
import java.util.*;
import javax.swing.*;
import javax.swing.border.*;
/*
 * Created by JFormDesigner on Thu May 25 19:48:30 CST 2023
 */



/**
 * @author wxz
 */
public class manger extends JFrame {
    public manger() {
        initComponents();
    }

    private void relogin(ActionEvent e) {
        // TODO add your code her
        Login relogin   = new Login();
        relogin.setVisible(true);
        this.dispose();
    }

    private void changeInfo(ActionEvent e) {
        // TODO add your code here
        Changeinfo changeinfo = new Changeinfo(this);
        changeinfo.setVisible(true);
    }

    private void chargerPrice(ActionEvent e) throws SQLException {
        // TODO add your code here
        Charger charger = new Charger(this);
        charger.setVisible(true);
        charger.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    }

    private void initComponents() {
        // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents  @formatter:off
        ResourceBundle bundle = ResourceBundle.getBundle("Gui");
        menuBar1 = new JMenuBar();
        menu1 = new JMenu();
        menuItem6 = new JMenuItem();
        menu2 = new JMenu();
        menuItem2 = new JMenuItem();
        menu3 = new JMenu();
        menuItem5 = new JMenuItem();
        menu4 = new JMenu();
        menuItem3 = new JMenuItem();
        menuItem4 = new JMenuItem();
        dialogPane = new JPanel();
        contentPanel = new JPanel();
        buttonBar = new JPanel();
        okButton = new JButton();
        cancelButton = new JButton();

        //======== this ========
        setTitle(bundle.getString("manger.this.title"));
        setPreferredSize(new Dimension(760, 512));
        var contentPane = getContentPane();
        contentPane.setLayout(new BorderLayout());

        //======== menuBar1 ========
        {
            menuBar1.setMinimumSize(new Dimension(244, 30));
            menuBar1.setPreferredSize(new Dimension(244, 35));

            //======== menu1 ========
            {
                menu1.setText(bundle.getString("manger.menu1.text"));
                menu1.setPreferredSize(new Dimension(61, 21));
                menu1.setHorizontalAlignment(SwingConstants.TRAILING);
                menu1.setMinimumSize(new Dimension(61, 21));

                //---- menuItem6 ----
                menuItem6.setText(bundle.getString("manger.menuItem6.text"));
                menu1.add(menuItem6);
            }
            menuBar1.add(menu1);

            //======== menu2 ========
            {
                menu2.setText(bundle.getString("manger.menu2.text"));

                //---- menuItem2 ----
                menuItem2.setText(bundle.getString("manger.menuItem2.text"));
                menu2.add(menuItem2);
            }
            menuBar1.add(menu2);

            //======== menu3 ========
            {
                menu3.setText(bundle.getString("manger.menu3.text"));

                //---- menuItem5 ----
                menuItem5.setText(bundle.getString("manger.menuItem5.text"));
                menuItem5.addActionListener(e -> {
                    try {
                        chargerPrice(e);
                    } catch (SQLException ex) {
                        throw new RuntimeException(ex);
                    }
                });
                menu3.add(menuItem5);
            }
            menuBar1.add(menu3);

            //======== menu4 ========
            {
                menu4.setText(bundle.getString("manger.menu4.text"));
                menu4.setHorizontalAlignment(SwingConstants.CENTER);

                //---- menuItem3 ----
                menuItem3.setText(bundle.getString("manger.menuItem3.text"));
                menuItem3.addActionListener(e -> changeInfo(e));
                menu4.add(menuItem3);

                //---- menuItem4 ----
                menuItem4.setText(bundle.getString("manger.menuItem4.text"));
                menuItem4.addActionListener(e -> relogin(e));
                menu4.add(menuItem4);
            }
            menuBar1.add(menu4);
        }
        contentPane.add(menuBar1, BorderLayout.NORTH);

        //======== dialogPane ========
        {
            dialogPane.setBorder(new EmptyBorder(12, 12, 12, 12));
            dialogPane.setLayout(new BorderLayout());

            //======== contentPanel ========
            {
                contentPanel.setPreferredSize(new Dimension(244, 35));
                contentPanel.setLayout(new BorderLayout());
            }
            dialogPane.add(contentPanel, BorderLayout.CENTER);

            //======== buttonBar ========
            {
                buttonBar.setBorder(new EmptyBorder(12, 0, 0, 0));
                buttonBar.setLayout(new GridBagLayout());
                ((GridBagLayout)buttonBar.getLayout()).columnWidths = new int[] {0, 85, 80};
                ((GridBagLayout)buttonBar.getLayout()).columnWeights = new double[] {1.0, 0.0, 0.0};

                //---- okButton ----
                okButton.setText(bundle.getString("manger.okButton.text"));
                buttonBar.add(okButton, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0,
                    GridBagConstraints.CENTER, GridBagConstraints.BOTH,
                    new Insets(0, 0, 0, 5), 0, 0));

                //---- cancelButton ----
                cancelButton.setText(bundle.getString("manger.cancelButton.text"));
                buttonBar.add(cancelButton, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0,
                    GridBagConstraints.CENTER, GridBagConstraints.BOTH,
                    new Insets(0, 0, 0, 0), 0, 0));
            }
            dialogPane.add(buttonBar, BorderLayout.SOUTH);
        }
        contentPane.add(dialogPane, BorderLayout.CENTER);
        pack();
        setLocationRelativeTo(getOwner());
        // JFormDesigner - End of component initialization  //GEN-END:initComponents  @formatter:on
    }

    // JFormDesigner - Variables declaration - DO NOT MODIFY  //GEN-BEGIN:variables  @formatter:off
    private JMenuBar menuBar1;
    private JMenu menu1;
    private JMenuItem menuItem6;
    private JMenu menu2;
    private JMenuItem menuItem2;
    private JMenu menu3;
    private JMenuItem menuItem5;
    private JMenu menu4;
    private JMenuItem menuItem3;
    private JMenuItem menuItem4;
    private JPanel dialogPane;
    private JPanel contentPanel;
    private JPanel buttonBar;
    private JButton okButton;
    private JButton cancelButton;
    // JFormDesigner - End of variables declaration  //GEN-END:variables  @formatter:on

}
